package com.capgemini.task;

import com.capgemini.task.domain.ScheduleJob;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 
 * @Description: 计划任务执行处 无状态
 * @author
 * @date
 */
public class QuartzJobFactory implements Job {
	public final Logger log = LoggerFactory.getLogger(this.getClass());

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		ScheduleJob scheduleJob = (ScheduleJob) context.getMergedJobDataMap().get("scheduleJob");

		TaskUtils.invokMethod(scheduleJob);



//		Integer result = (Integer)context.get("result");
//		Long runtime = context.getJobRunTime();
//
//		System.out.println(runtime);
//		JobExecutionException j = new JobExecutionException();
//		if(result == null || result < 3) {
//			context.put("result", result == null?2:result + 1);
//			j.setRefireImmediately(true);
//		}
	}
}